{include file="public/layout" /}
<body class="laytp-container">
<div class="layui-card">
  <div class="layui-card-body">
    <blockquote class="layui-elem-quote">
      清空数据一般用于测试使用，请谨慎操作
    </blockquote>
    <form class="layui-form" action="">
      <div class="layui-form-item">
        <label class="layui-form-label">设备密钥</label>
        <div class="layui-input-inline layui-input-wrap">
          <input type="text" name="title" lay-verify="required" value="" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">可选清空列表</label>
        <div class="layui-input-inline layui-input-wrap">
          <input type="checkbox" value="1" name="biao[goods]" title="产品（规格，属性，类型等等所有相关）"  />
        </div>
      </div>

      <div class="layui-form-item">
        <div class="layui-input-block">
          <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">确认</button>
        </div>
      </div>
    </form>
  </div>
</div>
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script>
  layui.use(['form', 'laydate', 'util'], function(){
    var form = layui.form;
    var layer = layui.layer;
    var laydate = layui.laydate;
    var util = layui.util;

    // 自定义验证规则
    form.verify({
      pass: [
        /^[\S]{6,12}$/,
        '密码必须6到12位，且不能出现空格'
      ]
    });

    // 指定开关事件
    // form.on('switch(switchTest)', function(data){
    //     layer.msg('开关 checked：'+ (this.checked ? 'true' : 'false'), {
    //         offset: '6px'
    //     });
    //     layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是 ON|OFF', data.othis)
    // });

    // 提交事件
    form.on('submit(demo1)', function(data){
      var index = layer.load();
      layer.close(index);

      var field = data.field; // 获取表单字段值
      $.ajax({
        type: "POST",
        url: "{:url('chushiDb66del')}",
        data: field,
        success: function(res){
          console.log(res);
          if(res.status){
            layer.msg('操作成功');
          }else{
            layer.msg(res.msg);
          }
        }
      });
      return false; // 阻止默认 form 跳转
    });

    // 日期
    laydate.render({
      elem: '#date'
    });


  });
</script>
</body>
</html>